﻿@using GMS.Framework.Contract
@using GMS.Framework.Utility
@using GMS.Framework.Web.Controls
@using GMS.Crm.Contract

@model PagedList<Customer>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section PageSpecificStyleSheetIncludes{
    <style type="text/css"> 
        select { margin:1px; width:150px;}
    </style>
}
<div class="row-fluid">
    <div class="span1">
        <div>
            <a class="btn blue thickbox" title='添加新客户' href="@Url.Action("Create")?TB_iframe=true&height=600&width=600"><i class="icon-plus icon-white"></i> 新增</a>
            <br />
            <a class="btn red" id="delete" href="javascript:;"><i class="icon-trash icon-white"></i> 删除</a>
        </div>
    </div>
    <div class="span11">
        @using (Html.BeginForm(null, null, null, FormMethod.Get, new { id = "search", @class = "form-inline" }))
        { 
        <div>
            置业顾问：@Html.TextBox("username", Request["username"], new { @class = "m-wrap small" })&nbsp;
             客户名：@Html.TextBox("name", Request["name"], new { @class = "m-wrap small" })&nbsp;
             客户编号：@Html.TextBox("number", Request["number"], new { @class = "m-wrap small" })&nbsp;
             客户电话：@Html.TextBox("tel", Request["tel"], new { @class = "m-wrap small" })&nbsp;
         </div>
            <div class="p10">
             性别：@Html.DropDownList("Gender", "全部")&nbsp;
            类型：@Html.DropDownList("Category", "全部")&nbsp;
            职业：@Html.DropDownList("Profession", "全部")&nbsp;
            年龄：@Html.DropDownList("AgeGroup", "全部")&nbsp;
            <button type="submit" class="btn">搜索 <i class="icon-search"></i></button>
      
        </div>
        }
    </div>
</div>

@using (Html.BeginForm("Delete", "Customer", FormMethod.Post, new { id = "mainForm" }))
{
<table class="table table-striped table-hover ">
    <thead>
        <tr>
            <th style="width: 8px;">
                <input type="checkbox" id="checkall" class="group-checkable" />
            </th>
            <th >
                客户名
            </th>
            <th >
                编号
            </th>
            <th >
                电话
            </th>
            <th >
                性别
            </th>
            <th >
                类型
            </th>
            <th >
                年龄
            </th>
            <th >
                职业
            </th>
            <th >
                置业顾问
            </th>
            <th >
                添加时间
            </th>     
            <th >
                来电数
            </th> 
            <th>
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var p in Model)
        {
        <tr>
            <td>
                <input type="checkbox" class="checkboxes" name='ids' value='@p.ID' />
            </td>
            <td  class="blue">
                <span>@p.Name</span>
            </td>
            <td>
                <span>@p.Number</span>
            </td>
            <td>
                <span>@p.Tel</span>
            </td>
            <td>
                <span>@EnumHelper.GetEnumTitle((EnumGender)p.Gender)</span>
            </td>
            <td>
                <span>@EnumHelper.GetEnumTitle((EnumCategory)p.Category)</span>
            </td>
             <td>
                <span>@EnumHelper.GetEnumTitle((EnumAgeGroup)p.AgeGroup)</span>
            </td>
            <td>
                <span>@EnumHelper.GetEnumTitle((EnumProfession)p.Profession)</span>
            </td>
            <td class="green">
                <span>@p.Username</span>
            </td>
            <td>
                <span>@p.CreateTime.ToCnDataString()</span>
            </td>
            <td class="toolbar">
                    @p.VisitRecords.Count <a href="@Url.Action("Index", "VisitRecord")?Customer.Tel=@p.Tel" target="_blank">查看来电</a>
            </td>
            <td>
                <a class="btn mini purple thickbox" title='编辑客户内容' href="@Url.Action("Edit", new { id = p.ID })?TB_iframe=true&height=600&width=600">
                    <i class="icon-edit"></i>
                    编辑
                </a>
            </td>
        </tr>
        }
    </tbody>
</table>
}
<div class="dataTables_paginate paging_bootstrap pagination">
    @Html.Pager(Model, new PagerOptions() { ShowTotalItemCount = true })
</div>

